<?php
/**
 * Created by PhpStorm.
 * User: qttx
 * Date: 2019/5/30
 * Time: 13:58
 */
namespace app\api\model;

class BalanceModel extends BaseModel
{
    protected $table = "xst_balance";
    protected $rule = [
        'id' => '',
    ];
    protected $msg = [
        'id' => '',
    ];
    /**余额查询*/
    public function balancelist($data)
    {
        $setting = new SettingModel();
        $balance_list = $this->where($data)->find();
        $circulate = $setting->setting(5);
        $circulation = $setting->setting(6);
        $xst = $setting->setting(4);
        $eth = $setting->setting(7);
        $balance_list['circulate'] = $balance_list['circulate']+$balance_list['shop_xst'];
        $balance_list['circulatermb'] = round($balance_list['circulate']*$circulate['value'],2);
        $balance_list['circulationrmb'] = round($balance_list['circulation']*$circulation['value'],2);
        $balance_list['xstrmb'] = round($balance_list['xst']*$xst['value'],2);
        $balance_list['ethrmb'] = round($balance_list['eth']*$eth['value'],2);
      	$balance_list['total'] = $balance_list['frozen'];
        return $balance_list;
    }
}